
package com.insigma.business.qrcode.soldier.dao;


import com.insigma.business.qrcode.common.annotation.Crypt;
import com.insigma.business.qrcode.soldier.dto.SoldierMessageInfoBSearcher;
import com.insigma.business.qrcode.soldier.entity.DataStatsCDO;
import com.insigma.business.qrcode.soldier.entity.SoldierMessageInfoDO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Crypt(decryptFields = {"idCardNo", "", ""})
public interface SoldierMessageInfoDao {

    
    List<SoldierMessageInfoDO> search(final SoldierMessageInfoBSearcher innerSearcher);

    
    SoldierMessageInfoDO get(final String id);

    
    Integer insert(final SoldierMessageInfoDO soldierMessageInfoDO);

    
    Integer update(final SoldierMessageInfoDO soldierMessageInfoDO);

    
    Integer delete(@Param("id") final String id,
                   @Param("modifierType") final String modifierType,
                   @Param("modifierId") final String modifierId);

    List<SoldierMessageInfoDO> listRemindAndUnreadMessageInfo(String soldierId);

    @Crypt(encryptParamIndex = {0})
    List<SoldierMessageInfoDO> listRemindAndUnreadMessageInfoByIdCardNo(String idCardNo);

    List<SoldierMessageInfoDO> listAllCrowdAndValid();

    List<SoldierMessageInfoDO> searchMyMessage(SoldierMessageInfoBSearcher soldierMessageInfoBSearcher);
    @Select("select name realName from soldier_basic_hz  where id_card = #{idCard} and is_push = '1' and is_deleted = '0' UNION all select real_name realName from soldier_apply_info where id_card_no = #{idCardNo} and is_push = '1' and is_deleted = '0'")
    List<SoldierMessageInfoDO> searchBusPushed(String idCard, String idCardNo);

    @Crypt(encryptParamIndex = {0})
    int countUnreadOfIdCardNo(String idCardNo);

    List<SoldierMessageInfoDO> searchMessageOfCrowd(SoldierMessageInfoBSearcher soldierMessageInfoBSearcher);

    int countByType(@Param("type")String type, @Param("month")String month);

    List<SoldierMessageInfoDO> listByBizType(String bizType);

    Integer countByTypeByAreaCode(@Param("bizType")String bizType, @Param("adminAreaCode")String adminAreaCode);

    List<DataStatsCDO> groupByArea(@Param("areaLike")String areaLike, @Param("nextLevel")int nextLevel, @Param("levelLength")int levelLength, @Param("bizType")String bizType);
}
